package com.example.h9iserver.common;

/**
 * 异常处理编码，前端依据编码处理异常显示值
 * Created by Andy on 2020/2/9.
 */
public enum ExceptionCodeConstants {

    SUCCESS(200, "成功", true),
    SUCCESS_WARNING(210, "成功，但是有警告", true),
    SUCCESS_PART(220, "部分成功", true),
    FAIL(700, "失败", false),
    FAIL_UNAUTHORIZED(500,"失败", false),
    ERROR(710, "错误", false),
    EXECEPTION(720, "异常", false),
    PARAM(730, "参数错误", false),
    PARAM_LEAK(731, "参数缺失", false),
    PARAM_FORMAT(732, "参数格式错误", false),
    PARAM_VARIFY(733, "参数校验失败", false),
    PARAM_REGULAR(734, "参数规则不匹配", false),
    REPEAT(740, "数据已存在", false),
    NOMATCH(750, "无匹配数据", false),
    NOMATCH_INSERT(751, "未新增", false),
    NOMATCH_UPDATE(752, "未修改", false),
    NOMATCH_DELETE(753, "未删除", false),
    AUTH(760, "未授权", false),
    AUTH_FAIL(761, "权限验证失败", false),
    AUTH_TOKEN(762, "token验证失败", false),
    AUTH_EXPIRE(763, "已过期", false),
    AUTH_FORBIDDEN(764, "权限禁止", false),
    AUTH_NOLOGIN(765, "未登陆", false),
    AUTH_NOUSER(766, "用户不存在", false),
    AUTH_WRONGPWD(767, "密码错误", false),
    AUTH_LOGINFAIL(768, "登录失败", false),
    AUTH_LOGINFORBIDEN(769, "禁止登录", false),
    FREQUENT(770, "调用太频繁", false),
    REMOTE(780, "远程调用故障", false),
    REMOTE_FAIL(781, "远程调用失败", false),
    REMOTE_ERROR(782, "远程调用错误", false),
    REMOTE_EXECPTION(783, "远程调用异常", false),
    REMOTE_LAUNCH(784, "远程调用发起失败", false),
    REMOTE_TIMEOUT(785, "远程调用超时", false),
    REMOTE_REFUSE(786, "远程调用被拒绝", false),
    REMOTE_UNKNOWN(789, "远程调用未知错误", false),
    SYS(790, "系统故障", false),
    SYS_ABANDON(791, "禁止调用", false),
    SYS_UNKNOWN(799, "未知错误", false),
    MSG_PUBLISH_FAIL(800, "消息已发布", false)
    ;

    public Integer errorCode;

    public String errorMessage;

    private Boolean success;

    ExceptionCodeConstants(Integer errorCode, String errorMessage, Boolean success){
        this.errorCode = errorCode;
        this.errorMessage = errorMessage;
        this.success = success;
    }

    public Integer getErrorCode() {
        return errorCode;
    }

    public void setErrorCode(Integer errorCode) {
        this.errorCode = errorCode;
    }

    public String getErrorMessage() {
        return errorMessage;
    }

    public void setErrorMessage(String errorMessage) {
        this.errorMessage = errorMessage;
    }

    public Boolean getSuccess() {
        return success;
    }

    public void setSuccess(Boolean success) {
        this.success = success;
    }
}
